package com.itcam.pro01;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * @author : Cammy.Wu
 * Description : 
 */

public class MyExecutors implements Runnable{
    @Override
    public void run() {
        System.out.println(Thread.currentThread().getName() + " run()方法执行中...");
    }
}

class ExecutorsTest{
    public static void main(String[] args) {
        ExecutorService threadPool = Executors.newSingleThreadExecutor();
        MyRunnable myRunnable = new MyRunnable();
        for (int i = 0; i < 5; i++) {
            threadPool.execute(myRunnable);
        }

        System.out.println("线程任务开始执行");
        threadPool.shutdown();
    }
}
